package com.example.SocialApplication.db.service;

import android.os.AsyncTask;
import com.example.SocialApplication.HelperFactory;
import com.example.SocialApplication.db.dao.ColorEntityDAO;
import com.example.SocialApplication.db.entity.ColorEntity;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;

public class AddColorsService extends AsyncTask<Void, Void, Void> {

    public AddColorsService() {
    }

    @Override
    protected Void doInBackground(Void... params) {
        Map<String, String> mapColors = new HashMap<String, String>();
        mapColors.put("#ff7519", "#78cb31");
        mapColors.put("#65549b", "#9bcf60");
        mapColors.put("#01b48a", "#ffc42e");
        mapColors.put("#fec947", "#fe4161");
        mapColors.put("#bcc7dd", "#cb64b3");
        mapColors.put("#2371bc", "#c0c8df");
        mapColors.put("#f69717", "#ffc44b");
        mapColors.put("#4accce", "#6c5599");
        mapColors.put("#e65059", "#fd9323");
        mapColors.put("#ff96bc", "#ea505c");

        mapColors.put("#8ae3da", "#daf58b");
        mapColors.put("#ca2da7", "#a7fa39");
        mapColors.put("#0f645b", "#5b7970");
        mapColors.put("#6a6914", "#14d577");
        mapColors.put("#14d577", "#777fe1");
        mapColors.put("#ffc42e", "#01b48a");
        mapColors.put("#9bcf60", "#65549b");
        mapColors.put("#fe4161", "#fec947");
        mapColors.put("#cb64b3", "#bcc7dd");
        mapColors.put("#78cb31", "#ff7519");

        mapColors.put("#c0c8df", "#2371bc");
        mapColors.put("#ffc44b", "#f69717");
        mapColors.put("#6c5599", "#4accce");
        mapColors.put("#ea505c", "#ff96bc");
        mapColors.put("#fd9323", "#e65059");
        mapColors.put("#daf58b", "#8ae3da");
        mapColors.put("#a7fa39", "#ca2da7");
        mapColors.put("#7c6e6d", "#0f645b");
        mapColors.put("#39be83", "#6a6914");
        mapColors.put("#778ebe", "#14d577");

        try {
//            ColorEntityDAO colorEntityDAO = HelperFactory.getHelper().getColorEntityDAO();
            for (String color : mapColors.keySet()) {
                ColorEntity entity = new ColorEntity(color, mapColors.get(color));
                HelperFactory.getHelper().getColorEntityDAO().create(entity);
//                colorEntityDAO.create(entity);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return null;
    }
}
